//package com.xiguaji.tiktok.task.awemecomment.repository;
//
//import com.fasterxml.jackson.databind.ObjectMapper;
//import com.xiguaji.boot.filecenter.s3.S3Template;
//import com.xiguaji.tiktok.task.awemecomment.AwemeComment;
//import lombok.SneakyThrows;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.beans.factory.annotation.Value;
//import org.springframework.stereotype.Repository;
//
//import java.util.List;
//
//@Repository
//public class AwemeCommentRepository {
//    private  String KEY_PREFIX = "aweme_comment/";
//
//    @Value("${xiguaji.s3.comment.bucket.name}")
//    private String BUCKET_NAME = "xiguas3";
//
//    @Autowired
//    ObjectMapper objectMapper;
//
//    @Autowired(required = false)
//    S3Template s3Template;
//
//    @SneakyThrows
//    public void save(long awemeId, List<AwemeComment> commentProperties) {
//        byte[] bytes = objectMapper.writeValueAsBytes(commentProperties);
//        if (s3Template == null) return;
//        s3Template.put(BUCKET_NAME, KEY_PREFIX + awemeId, bytes);
//    }
//
//    public String get(long awemeId) {
//        if (s3Template == null) return null;
//        return s3Template.getAsString(BUCKET_NAME, KEY_PREFIX + awemeId);
//    }
//}
